package com.ydc.ln.tutorial.gui.test.window;

import java.awt.Button;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Panel;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * 窗口中的容器
 * 
 * @author ydc
 * @date 下午11:17:10 2013-5-17
 */
public class PanelFrame extends Frame {

    /**
     * @Fields serialVersionUID
     */
    private static final long serialVersionUID = -3357793167462642578L;

    public static void main(String[] args) {
        PanelFrame pf = new PanelFrame("Panel in Frame");
        pf.setSize(500, 500);
        pf.setBackground(Color.GREEN);
        pf.setLayout(null);
        
        Panel p = new Panel();
        p.setSize(200, 200);
        p.setBackground(Color.YELLOW);
        p.setLocation(100, 100);
        
        Button b1 = new Button("Help");
        Button b2 = new Button("About");
        
        p.add(b1);
        p.add(b2);
        
        pf.add(p);
        pf.setVisible(true);
    }

    public PanelFrame(String title) {
        super(title);
        this.addWindowListener(new WindowAdapter(){
           public void windowClosing(WindowEvent e) {
               System.exit(0);
           }
        });
    }

}
